//
//  CustomField.m
//  diangu
//
//  Created by 李 佳伟 on 2016/11/25.
//  Copyright © 2016年 李 佳伟. All rights reserved.
//

#import "CustomField.h"

@implementation CustomField

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

//控制placeHolder的位置，左右缩20

-(CGRect)placeholderRectForBounds:(CGRect)bounds

{

    //return CGRectInset(bounds, 20, 0);
    CGRect rect=[@"🔍搜索商家,商品名称" boundingRectWithSize:CGSizeMake(1000,bounds.size.height) options: NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:16.0f],NSFontAttributeName, nil] context:nil];
    CGRect inset = CGRectMake(bounds.origin.x+(bounds.size.width-rect.size.width)/2, bounds.origin.y, rect.size.width, bounds.size.height);//更好理解些
    
    return inset;
    
}





@end
